IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'spCategories_Create')
	BEGIN
		PRINT 'Dropping Procedure spCategories_Create'
		DROP  Procedure  spCategories_Create
	END

GO

PRINT 'Creating Procedure spCategories_Create'
GO
CREATE Procedure dbo.spCategories_Create
	( 	  
	  @CategoryName varchar(50), 
		@DivisionName varchar(50)
	)
AS
  /* 
    ------------------------------------------------------------------------------
    - Change History
    - --------------
    - Date          Description
    ------------------------------------------------------------------------------
    - 2007/11/02    Initial version created
    ------------------------------------------------------------------------------
  */

	-- Declare the required variables

	-- Create the required new record
	INSERT INTO Categories
	  (
		CategoryName,
			DivisionName	  
	  )
	VALUES
	  (
		@CategoryName,
			@DivisionName
	  )

	-- Handle any errors
	IF @@ERROR != 0
	BEGIN
		RAISERROR('spCategories_Create: Unable to Insert a new Categories', 10, 1)
		RETURN
	END

	-- Return the newly created ID
	SELECT	@@IDENTITY AS 'Categories_ID'

	-- Return to calling method
	RETURN 

GO
